﻿namespace MobileTrack.Core.Model
{
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Data.Services.Common;
    using System.Globalization;

    [Table("Sucursales")]
    [EntityPropertyMapping("Nombre", SyndicationItemProperty.Title, SyndicationTextContentKind.Plaintext, true)]
    [EntityPropertyMapping("Direccion", SyndicationItemProperty.Summary, SyndicationTextContentKind.Plaintext, true)]
    public class Sucursal : BaseEntity
    {
        [Required]
        [MaxLength(75)]
        public string Codigo { get; set; }

        [Required]
        [MaxLength(150)]
        public string Nombre { get; set; }

        [MaxLength(150)]
        public string Direccion { get; set; }

        [MaxLength(25)]
        [DataType(DataType.PhoneNumber)]
        public string Telefono { get; set; }

        [NotMapped]
        public string DisplayName
        {
            get { return string.Format(CultureInfo.InvariantCulture, "{0} ({1})", this.Nombre, this.Codigo); }
        }
    }
}
